#include <stdio.h>
#include <stdlib.h>
#include "commands.h"
#include "parse_lisp.h"
#include "engine.h"

int main() {

	// Open file
	/*
	FILE *f = fopen("examples/hello_triangle", "r");
	if (!f) {
		printf("error opening file\n");
		return -1;
	}

	struct avgdl_cmd *cmd;
	struct avgdl_action *act;

	// Read commands until EOF or error
	while (cmd = parse_command(f)) {

		act = execute_command(cmd);

	}
	*/

	//initialize_engine("test");

	// Simulated data
	int numOfSrc = 1;

	struct avgdl_engine *engine;
	struct avgdl_command cmd_obj = {"object", 0};
	struct avgdl_command cmd_asf = {"asf", 0};

	// Initialize engine
	engine = initialize_engine();

	FILE *f = fopen("examples/hello_triangle", "r");
	struct avgdl_command *cmd;
	while (cmd = parse_command(f)) {
		execute_command(engine, cmd);
		free_command(cmd);
	}
	fclose(f);
	clean_engine(engine);

	return 0;
}
